package systemServer.reproduction;
 
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.PrimaryKey;

import systemServer.members.Member;
import dao.PlayDAO;
import dto.Assembler;
import dto.SongDTO;
import dto.SongInfoDTO;
@PersistenceCapable
public class Song {
	@PrimaryKey
	private int id;
	private String title;
	private String artist;
	private int duration; //in seconds
	private long releaseDate;
	private double pricePerPlay;
	private String lyrics;
	private String song; //this will be the file, for this example we will use just a String instead of a File
	
	public Song(int id,String title, String artist, int duration, long releaseDate,
			double pricePerPlay, String lyrics, String song) {
		super();
		this.id = id;
		this.title = title;
		this.artist = artist;
		this.duration = duration;
		this.releaseDate = releaseDate;
		this.pricePerPlay = pricePerPlay;
		this.lyrics = lyrics;
		this.song = song;
	}

	public String getTitle() {
		return title;
	}

	public String getArtist() {
		return artist;
	}

	public int getDuration() {
		return duration;
	}

	public long getReleaseDate() {
		return releaseDate;
	}

	public double getPricePerPlay() {
		return pricePerPlay;
	}

	public String getLyrics() {
		return lyrics;
	}

	public String getSong() {
		return song;
	}
	public int getId(){
		return id;
	}
	
	public SongDTO play(Member member) {
//		PlayDAO.getInstance().addPlay(new Play(System.currentTimeMillis(),pricePerPlay,this,member));
		return Assembler.createSongDTO(this);
	}

	@Override
	public String toString() {
		return "Song [id=" + id + ", title=" + title + ", artist=" + artist
				+ ", duration=" + duration + ", releaseDate=" + releaseDate
				+ ", pricePerPlay=" + pricePerPlay + ", lyrics=" + lyrics
				+ ", song=" + song + "]";
	}
}
